// RibbonGroup.java
package exercise.jslide.jslide.view.ribbon;

import javafx.scene.control.Label;
import javafx.scene.layout.VBox;
import javafx.scene.layout.HBox;
import javafx.scene.Node;
import javafx.collections.ObservableList;
import javafx.geometry.Insets;

public class RibbonGroup extends VBox {
    private Label titleLabel;
    private HBox contentBox;

    public RibbonGroup(String title) {
        super(5);  // 设置垂直间距
        setPadding(new Insets(5));

        titleLabel = new Label(title);
        titleLabel.getStyleClass().add("ribbon-group-title");

        contentBox = new HBox(5);  // 设置水平间距

        getStyleClass().add("ribbon-group");

        getChildren().addAll(contentBox, titleLabel);
    }

    // 返回可观察的节点列表
    public ObservableList<Node> getItems() {
        return contentBox.getChildren();
    }

    // 添加单个节点
    public void addItem(Node item) {
        contentBox.getChildren().add(item);
    }

    // 添加多个节点
    public void addAll(Node... items) {
        contentBox.getChildren().addAll(items);
    }
}